﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Abhimanu.Mobile.Models
{
    [Serializable]
    public class SessionInfo
    {
        public long UserID { get; set; }
        public string Name { get; set; }

        public static string SetSession(long userId, string Name)
        {
            return string.Format("{0}-{1}", userId, Name);
        }

        public static SessionInfo GetSessionInfo(string persistentInfo)
        {
            SessionInfo sessionInfo = new SessionInfo();
            string[] splitStr = persistentInfo.Split('-');
            if (splitStr.Length == 2)
            {
                sessionInfo.UserID = Convert.ToInt64(splitStr[0]);
                sessionInfo.Name = splitStr[1];
            }

            return sessionInfo;
        }
    }
}